#ifndef _GEN_IR_H
#define _GEN_IR_H

#include "common.h"
#include "Semantic.h"
#include "InterCode.h"

void _Program(TreeNode* root);
void _ExtDefList(TreeNode *n);
void _ExtDef(TreeNode *n);
void _ExtDecList(TreeNode *n, Type type);

Type _Specifier(TreeNode *n);
Type _StructSpecifier(TreeNode *n);

FieldList _VarDec(TreeNode *n, Type type, From from);
Function _FunDec(TreeNode *n, Type type);
FieldList _VarList(TreeNode *n);
FieldList _ParamDec(TreeNode *n);

void _CompSt(TreeNode *n, Function BlngFunc);
void _StmtList(TreeNode *n, Function BlngFunc);
void _Stmt(TreeNode *n, Function BlngFunc);

FieldList _DefList(TreeNode *n, From from);
FieldList _Def(TreeNode *n, From from);
FieldList _DecList(TreeNode *n, Type type, From from);
FieldList _Dec(TreeNode *n, Type type, From from);

Type _Exp(TreeNode *n, Operand res);
Type Exp_Cond(TreeNode *n,Operand label_true, Operand label_false);
bool _Args(TreeNode *n, FieldList param, Operand* arg_pr);

int typeSize(Type type);

#endif
